package com.djl.crowd.service.impl;

import com.djl.crowd.entity.po.MemberPO;
import com.djl.crowd.entity.po.MemberPOExample;
import com.djl.crowd.mapper.MemberPOMapper;
import com.djl.crowd.service.api.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author le
 * @Date 2022/3/8 12:42
 * @Version 1.0
 */
@Transactional(readOnly = true)
@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberPOMapper memberPOMapper;

    @Override
    public MemberPO getMemberPOByLoginAcct(String loginAcct) {

        // 封装查询条件
        MemberPOExample example = new MemberPOExample();
        MemberPOExample.Criteria criteria = example.createCriteria();
        criteria.andLoginAcctEqualTo(loginAcct);

        List<MemberPO> memberPOS = memberPOMapper.selectByExample(example);

        return memberPOS.get(0);
    }
}
